/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author david.carranza
 */
@Entity
@Table(name = "cex_tipo_examen_laboratorio")
@NamedQueries({
    @NamedQuery(name = "CexTipoExamenLaboratorio.findAll", query = "SELECT c FROM CexTipoExamenLaboratorio c")})
public class CexTipoExamenLaboratorio implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ctl_id")
    private Integer ctlId;
    @Basic(optional = false)
    @Column(name = "ctl_nombre")
    private String ctlNombre;
    @Basic(optional = false)
    @Column(name = "ctl_estado")
    private int ctlEstado;
    @Column(name = "ctl_orden")
    private Integer ctlOrden;
    @JoinTable(name = "cex_pedido_detalle_laboratorio", joinColumns = {
        @JoinColumn(name = "ctl_id", referencedColumnName = "ctl_id")}, inverseJoinColumns = {
        @JoinColumn(name = "cpl_id", referencedColumnName = "cpl_id")})
    @ManyToMany(fetch = FetchType.LAZY)
    private List<CexPedidoLaboratorio> cexPedidoLaboratorioList;
    
    @OneToMany(mappedBy = "cexTipoExamenLaboratorio", fetch = FetchType.LAZY)
    private List<CexTipoExamenLaboratorio> cexTipoExamenLaboratorioList;
    @JoinColumn(name = "ctl_ctl_id", referencedColumnName = "ctl_id")
    @ManyToOne(fetch = FetchType.LAZY)
    
    private CexTipoExamenLaboratorio cexTipoExamenLaboratorio;
    @OneToMany(mappedBy = "cexTipoExamenLaboratorio", fetch = FetchType.LAZY)
    private List<CexResultadoLaboratorio> cexResultadoLaboratorioList;
    @Transient
    private boolean seleccionar;

    public CexTipoExamenLaboratorio() {
    }

    public CexTipoExamenLaboratorio(Integer ctlId) {
        this.ctlId = ctlId;
    }

    public CexTipoExamenLaboratorio(Integer ctlId, String ctlNombre, int ctlEstado) {
        this.ctlId = ctlId;
        this.ctlNombre = ctlNombre;
        this.ctlEstado = ctlEstado;
    }

    public Integer getCtlId() {
        return ctlId;
    }

    public void setCtlId(Integer ctlId) {
        this.ctlId = ctlId;
    }

    public String getCtlNombre() {
        return ctlNombre;
    }

    public void setCtlNombre(String ctlNombre) {
        this.ctlNombre = ctlNombre;
    }

    public int getCtlEstado() {
        return ctlEstado;
    }

    public void setCtlEstado(int ctlEstado) {
        this.ctlEstado = ctlEstado;
    }

    public Integer getCtlOrden() {
        return ctlOrden;
    }

    public void setCtlOrden(Integer ctlOrden) {
        this.ctlOrden = ctlOrden;
    }

    public List<CexPedidoLaboratorio> getCexPedidoLaboratorioList() {
        return cexPedidoLaboratorioList;
    }

    public void setCexPedidoLaboratorioList(List<CexPedidoLaboratorio> cexPedidoLaboratorioList) {
        this.cexPedidoLaboratorioList = cexPedidoLaboratorioList;
    }

    public List<CexTipoExamenLaboratorio> getCexTipoExamenLaboratorioList() {
        return cexTipoExamenLaboratorioList;
    }

    public void setCexTipoExamenLaboratorioList(List<CexTipoExamenLaboratorio> cexTipoExamenLaboratorioList) {
        this.cexTipoExamenLaboratorioList = cexTipoExamenLaboratorioList;
    }

    public CexTipoExamenLaboratorio getCexTipoExamenLaboratorio() {
        return cexTipoExamenLaboratorio;
    }

    public void setCexTipoExamenLaboratorio(CexTipoExamenLaboratorio cexTipoExamenLaboratorio) {
        this.cexTipoExamenLaboratorio = cexTipoExamenLaboratorio;
    }

    public List<CexResultadoLaboratorio> getCexResultadoLaboratorioList() {
        return cexResultadoLaboratorioList;
    }

    public void setCexResultadoLaboratorioList(List<CexResultadoLaboratorio> cexResultadoLaboratorioList) {
        this.cexResultadoLaboratorioList = cexResultadoLaboratorioList;
    }

    public boolean isSeleccionar() {
        return seleccionar;
    }

    public void setSeleccionar(boolean seleccionar) {
        this.seleccionar = seleccionar;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ctlId != null ? ctlId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CexTipoExamenLaboratorio)) {
            return false;
        }
        CexTipoExamenLaboratorio other = (CexTipoExamenLaboratorio) object;
        if ((this.ctlId == null && other.ctlId != null) || (this.ctlId != null && !this.ctlId.equals(other.ctlId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "newpackage.CexTipoExamenLaboratorio[ ctlId=" + ctlId + " ]";
    }

}
